#include <iostream>
#include <list>
using namespace std;


void show_list(list<int> L)
{ list<int>::iterator p;
  for(p=L.begin(); p!=L.end(); p++)
    cout << *p << " ";
  cout << endl;
}    
  
int a[5] = {32,45,12,24,29};
int b[7] = {13,15,10,56,34,45,77};

list<int> L(a,a+5);
list<int> R(b,b+7);

int main()
{ 
  show_list(L);
  show_list(R);

  list<int>::iterator p;
  p = L.begin();
  ++p; ++p;
  cout << *p << endl;
  
  list<int>::iterator q = R.begin();
  ++q; ++q; ++q; 
  cout << *q << endl;
  
  

  L.splice(p,R,q,R.end());  
  show_list(L);
  show_list(R);
    
  return 0;
}    
